<script setup>
import { ref } from 'vue'
import TitleValue from '@components/TitleValue'
import Basic from './Basic'
import Court from './Court'
import Hit from './Hit'
import Loans from './Loans'
import LoanSend from './LoanSend'
import LoanApply from './LoanApply'
import Overdue from './Overdue'
import Relevance from './Relevance'
import Roll from './Roll'
import LeaseHistory from './LeaseHistory'

const visible = ref(false)
const lease = ref()

const open = (value) => {
    lease.value = value
    visible.value = true
}

const close = () => {
    visible.value = false
    lease.value = {}
}

//把方法暴露给父组件
defineExpose({
    open
})
</script>
        
<template>
    <el-dialog v-model="visible" title="风控结果" center @close="close" destroy-on-close :width="lease && lease.isOK ? '85%' : '40%'">
        <section v-if="lease">
            <section v-if="lease.isOK">
                <el-row>
                    <el-col :span="12">
                        <title-value title="审核建议:" class="font2" :value="lease.verify_recomment" />
                    </el-col>
                    <el-col :span="12">
                        <title-value title="评估分值:" class="font2" :value="lease.score_norm_explain" />
                    </el-col>
                </el-row>
                <el-tabs type="border-card">
                    <el-tab-pane label="基本信息" v-if="lease.base_info">
                        <basic :data="lease.base_info" />
                    </el-tab-pane>
                    <el-tab-pane label="法院风险信息" v-if="lease.court_risk_info_list && lease.court_risk_info_list.length > 0">
                        <court :data="lease.court_risk_info_list" />
                    </el-tab-pane>
                    <el-tab-pane label="命中风险标注" v-if="lease.hit_risk_tagging">
                        <hit :data="lease.hit_risk_tagging" />
                    </el-tab-pane>
                    <el-tab-pane label="近期贷款需求" v-if="lease.personal_loan_demand">
                        <loans :data="lease.personal_loan_demand" />
                    </el-tab-pane>
                    <el-tab-pane label="贷款放款信息" v-if="lease.personal_loan_f">
                        <loan-send :data="lease.personal_loan_f" />
                    </el-tab-pane>
                    <el-tab-pane label="贷款申请信息" v-if="lease.personal_loan_s">
                        <loan-apply :data="lease.personal_loan_s" />
                    </el-tab-pane>
                    <el-tab-pane label="历史逾期记录" v-if="lease.personal_overdue_history">
                        <overdue :data="lease.personal_overdue_history" />
                    </el-tab-pane>
                    <el-tab-pane label="关联⻛险检测" v-if="lease.relevance_risk_check">
                        <relevance :data="lease.relevance_risk_check" />
                    </el-tab-pane>
                    <el-tab-pane label="⻛险名单检测" v-if="lease.risk_list_check">
                        <roll :data="lease.risk_list_check" />
                    </el-tab-pane>
                    <el-tab-pane label="历史租赁印记" v-if="lease.rent_history">
                        <lease-history :data="lease.rent_history" />
                    </el-tab-pane>
                </el-tabs>
                <div class="marginY10">匹配度举例：0.99
                    匹配度是⼀个概率(范围为0~1),匹配度为0,则完全不匹配;匹配度为1,则完全匹配。通常匹配度达到0.8及以上，相似度已经很⾼,基本上可以确定是这个⼈；匹配度在0.5及以下,说明可以关联到部分信息,但是相似度较低,⼤概率不是这个⼈;匹配度在0.5-0.8
                    时，需根据⽤户的⻛控策略，做取舍。</div>
                <div class="marginY10">逾期天数 (S:单期 M:多期) S/M表示逾期的期数。S代表现⾦贷的期数，1 期=7天，S0表示不到7天、S1代表7-14天，以
                    此类推；M代表消费分期的期数，1期=30天， M0表示不到30天，M1代表30-60天，以此类 推。</div>
                <div class="marginY10"> 分值标准说明： 分值在200⾄700之间，得分越 低，⻛险越⾼: 【620， ++）建议通过； 【500， 620）建议审核； （--，
                    500）建议拒绝</div>
            </section>
            <section v-else>
                <el-row>
                    <el-col>
                        <title-value title="分值:" class="font2" :value="lease.result" />
                    </el-col>
                </el-row>
                <el-row v-if="lease.reason">
                    <el-col>
                        <title-value title="原因:" class="font2" :value="lease.reason" />
                    </el-col>
                </el-row>
                <div>分值标准说明： 分值在200⾄700之间，得分越 低，⻛险越⾼: 【620， ++）建议通过； 【500， 620）建议审核； （--， 500）建议拒绝</div>
            </section>
        </section>
    </el-dialog>
</template>
        